package com.gaoxinfu.demo.spring.cloud.jpa.customize.service;

import com.gaoxinfu.demo.spring.cloud.jpa.customize.entity.Money;
import com.gaoxinfu.demo.spring.cloud.jpa.customize.repository.MoneyRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Optional;

/**
 * @Description:
 * @Author: gaoxinfu
 * @Date: 7/7/21 07:27
 */
@Service
public class MoneyService {

    @Resource
    MoneyRepository moneyRepository;

    public Money findById(Integer id){
        Optional<Money> optional =  moneyRepository.findById(1);
        if (optional.isPresent()){
            return optional.get();
        }
        return null;
    }
}
